home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / SAMPLES.BIN / Plasma.java < prev    next >
Encoding:
Java Source  |  1996-12-03  |  2.2 KB  |  114 lines

  1. /*
  2.     A basic extension of the java.awt.Frame class
  3.  */
  4.  
  5. import java.awt.*;
  6.  
  7. public class Plasma extends Frame {
  8.     void close_Clicked(Event event) {
  9.  
  10.  
  11.         //{{CONNECTION
  12.         // Stop the plasma animation
  13.         {
  14.             plasma1.stopPlasma();
  15.         }
  16.         //}}
  17.  
  18.         //{{CONNECTION
  19.         // Hide the Frame
  20.         hide();
  21.         //}}
  22.     }
  23.  
  24.     void start_Clicked(Event event) {
  25.  
  26.  
  27.         //{{CONNECTION
  28.         // Start the plasma animation
  29.         {
  30.             plasma1.startPlasma();
  31.         }
  32.         //}}
  33.     }
  34.  
  35.     void About_Clicked(Event event) {
  36.  
  37.  
  38.         //{{CONNECTION
  39.         // Stop the plasma animation
  40.         {
  41.             plasma1.stopPlasma();
  42.         }
  43.         //}}
  44.     }
  45.  
  46.  
  47.     public Plasma() {
  48.  
  49.         //{{INIT_CONTROLS
  50.         setLayout(null);
  51.         addNotify();
  52.         resize(insets().left + insets().right + 478,insets().top + insets().bottom + 107);
  53.         setBackground(new Color(65535));
  54.         Stop = new java.awt.Button("Stop the Plasma");
  55.         Stop.reshape(insets().left + 172,insets().top + 72,126,24);
  56.         add(Stop);
  57.         start = new java.awt.Button("Re-Start the Plasma");
  58.         start.reshape(insets().left + 333,insets().top + 72,126,24);
  59.         add(start);
  60.         close = new java.awt.Button("Close");
  61.         close.reshape(insets().left + 11,insets().top + 72,126,24);
  62.         add(close);
  63.         plasma1 = new symantec.itools.multimedia.Plasma();
  64.         plasma1.reshape(insets().left + -2,insets().top + 1,479,107);
  65.         add(plasma1);
  66.         plasma1.setPreviewMode(false);
  67.         setTitle("Untitled");
  68.         //}}
  69.  
  70.         //{{INIT_MENUS
  71.         //}}
  72.     }
  73.  
  74.     public Plasma(String title) {
  75.         this();
  76.         setTitle(title);
  77.     }
  78.  
  79.     public synchronized void show() {
  80.         move(50, 50);
  81.         super.show();
  82.     }
  83.  
  84.     public boolean handleEvent(Event event) {
  85.         if (event.id == Event.WINDOW_DESTROY) {
  86.             hide();         // hide the Frame
  87.             return true;
  88.         }
  89.         if (event.target == Stop && event.id == Event.ACTION_EVENT) {
  90.             About_Clicked(event);
  91.             return true;
  92.         }
  93.         if (event.target == start && event.id == Event.ACTION_EVENT) {
  94.             start_Clicked(event);
  95.             return true;
  96.         }
  97.         if (event.target == close && event.id == Event.ACTION_EVENT) {
  98.             close_Clicked(event);
  99.             return true;
  100.         }
  101.         return super.handleEvent(event);
  102.     }
  103.  
  104.     //{{DECLARE_CONTROLS
  105.     java.awt.Button Stop;
  106.     java.awt.Button start;
  107.     java.awt.Button close;
  108.     symantec.itools.multimedia.Plasma plasma1;
  109.     //}}
  110.  
  111.     //{{DECLARE_MENUS
  112.     //}}
  113. }
  114.